﻿<Window x:Class="FlowStudio.AddActivitiesWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:view="clr-namespace:FlowStudio.View"
        Title="Add Activities"
        MinWidth="400"
        MinHeight="300"
        Height="470"
        Width="840" 
        ResizeMode="CanResizeWithGrip"
        WindowStartupLocation="CenterOwner"
        WindowStyle="ToolWindow"
        DataContext="{Binding Source={RelativeSource Self}}">
    
    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ListView Grid.Row="0" ItemsSource="{Binding ActivityTypeItems}">
            <ListView.Resources>
                <view:DataContextSpy x:Key="dataContextSpy"/>
            </ListView.Resources>
            <ListView.View>
                <GridView>
                    <GridViewColumn>
                        <GridViewColumn.HeaderTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding Source={StaticResource dataContextSpy}, Path=DataContext.ActivitiesSelectionToggle, Mode=TwoWay}"/>
                            </DataTemplate>
                        </GridViewColumn.HeaderTemplate>
                        <GridViewColumn.CellTemplate>
                            <ItemContainerTemplate>
                                <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}"/>
                            </ItemContainerTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn DisplayMemberBinding="{Binding ActivityType.Name}" Width="170" Header="Name">
                        <GridViewColumn.HeaderContainerStyle>
                            <Style TargetType="GridViewColumnHeader">
                                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                            </Style>
                        </GridViewColumn.HeaderContainerStyle>
                    </GridViewColumn>
                    <GridViewColumn Header="Version" DisplayMemberBinding="{Binding Version}" Width="80">
                        <GridViewColumn.HeaderContainerStyle>
                            <Style TargetType="GridViewColumnHeader">
                                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                            </Style>
                        </GridViewColumn.HeaderContainerStyle>
                    </GridViewColumn>
                    <GridViewColumn Header="Location" DisplayMemberBinding="{Binding ActivityType.Assembly.Location}" Width="440">
                        <GridViewColumn.HeaderContainerStyle>
                            <Style TargetType="GridViewColumnHeader">
                                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                            </Style>
                        </GridViewColumn.HeaderContainerStyle>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="ToolTip" Value="{Binding ActivityType.Assembly.Location}"/>
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>
        
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <Button Content="Add" Grid.Column="1" Margin="10,10,0,0" Width="70" Height="25" IsDefault="True"
                    Command="{Binding AddCommand}"/>
            <Button Content="Cancel" Grid.Column="2" Margin="10,10,0,0" Width="70" Height="25" IsCancel="True" />
        </Grid>
    </Grid>
</Window>
